﻿using System.Collections.Generic;

namespace MiscHelper
{
    public static class WebAddressParser
    {
        public static List<string> Parse(string sz)
        {
            var ret = new List<string>();
            if (string.IsNullOrEmpty(sz))
                return ret;

            sz = sz.Trim().ToLower();
            if (string.IsNullOrEmpty(sz))
                return ret;

            // delimiters are not standardised!
            sz = sz.Replace('/', ',');
            sz = sz.Replace(';', ',');
            string[] sa = sz.Split(',');
            foreach (var emailAddress in sa)
            {
                if (emailAddress.Contains("."))
                    ret.Add(emailAddress.Trim());
            }
            return ret;
        }

    
    }
}
